<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Notepad</title>

    <!-- bootstrap -->
    <link rel="stylesheet" href="./assets/css/bootstrap.min.css" />

    <!-- animate.css -->
    <link rel="stylesheet" href="./assets/css/animate.min.css" />

    <!-- mui -->
    <link rel="stylesheet" href="./assets/plugins/mui/css/mui.min.css" />

    <!-- 重置样式 -->
    <link rel="stylesheet/less" href="./assets/css/reset.less" />

    <!-- 公共样式 -->
    <link rel="stylesheet/less" href="./assets/css/common.less" />

    <!-- 页面独立的 -->
    <link rel="stylesheet/less" href="./assets/css/UserIndex.less" />
</head>
<body>
    <!-- 用户信息 -->
    <div class="user">
        <div class="avatar wow fadeInUp">
            <img src="./assets/images/avatar.png" />
        </div>

        <div class="nickname wow fadeInUp" data-wow-delay="100ms">FunkyRicky</div>
    </div>

    <!-- 菜单 -->
    <div class="menulist wow fadeInUp" data-wow-delay="300ms">
        <a href="UserProfile.html" class="item">
            <span>基本资料</span>
            <img src='./assets/images/row.png' />
        </a>
        <a href="TypeIndex.html" class="item">
            <span>通讯录分类</span>
            <img src='./assets/images/row.png' />
        </a>

        <a href="javascript:void(0)" class="item" id="logout">
            <span>退出账号</span>
            <img src='./assets/images/row.png' />
        </a>
    </div>


    <!-- 底部 -->
    <div class="tabbar">
        <div class="box">
            <a href="index.html" class="item">
                <span class="icon glyphicon glyphicon-home"></span>
                <span class="name">首页</span>
            </a>
            <a href="ContactAdd.html" class="item">
                <span class="icon glyphicon glyphicon-list-alt"></span>
                <span class="name">新建</span>
            </a>
            <a href="UserIndex.html" class="item">
                <span class="icon glyphicon glyphicon-user"></span>
                <span class="name">我的</span>
            </a>
        </div>
    </div>
</body>
</html>
<!-- 解析less的文件 -->
<script src="./assets/js/less.min.js"></script>

<!-- jquery  -->
<script src="./assets/js/jquery.min.js"></script>

<!-- bootstrap -->
<script src="./assets/js/bootstrap.min.js"></script>

<!-- wow.js -->
<script src="./assets/js/wow.min.js"></script>

<!-- mui -->
<script src="./assets/plugins/mui/js/mui.min.js"></script>

<!-- axios -->
<script src="./assets/plugins/axios/axios.min.js"></script>

<!-- 服务请求 -->
<script src="./assets/plugins/axios/request.js"></script>

<!-- cookie -->
<script src="./assets/plugins/cookie.js"></script>

<!-- helpers -->
<script src="./assets/plugins/helpers.js"></script>

<script>
    //实例化wow.js
    new WOW().init();

    // 定义存放登录信息的变量
    let business = {};

    (async () => {
        let result = await check(true,true);

        business = result.data ? result.data : {};

        if(Object.getOwnPropertyNames(business).length > 0)
        {
            $('.avatar img').attr('src',business.avatar);
            $('.nickname').text(business.nickname);
        }
    })();

    // 退出账号事件
    $('#logout').click(function(){
        // 弹出确认框
        mui.confirm('是否确认退出当前账号？','退出账号',function(res){
            if(res.index === 1)
            {
                cookie.remove('business');

                mui.toast('退出当前账号成功',{duration:1500});

                setTimeout(() => location.href = 'login.html',1500);
            }
        })
    })
    
</script>